package com.dify.tool.service.impl;

import com.dify.tool.api.dto.AgentManageDTO;
import com.dify.tool.api.vo.AgentStatisticsVO;
import com.dify.tool.common.enums.DifyAppEnum;
import com.dify.tool.dal.mapper.AgentManageMapper;
import com.dify.tool.service.IAgentManageService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 代码生成业务表 服务实现类
 * </p>
 *
 * @author shl
 * @since 2025-06-03
 */
@Slf4j
@Service
public class AgentManageServiceImpl implements IAgentManageService {

    @Resource
    private AgentManageMapper agentManageMapper;

    @Override
    public List<AgentStatisticsVO> conversationsStatistics(AgentManageDTO query) {
        query.setAppId(DifyAppEnum.getAppIdByCode(query.getAppCode()));
        return agentManageMapper.conversationStatistics(query);
    }

    @Override
    public List<AgentStatisticsVO> terminalStatistics(AgentManageDTO query) {
        query.setAppId(DifyAppEnum.getAppIdByCode(query.getAppCode()));
        return agentManageMapper.terminalStatistics(query);
    }

    @Override
    public List<AgentStatisticsVO> satisfyStatistics(AgentManageDTO query) {
        query.setAppId(DifyAppEnum.getAppIdByCode(query.getAppCode()));
        return agentManageMapper.satisfyStatistics(query);
    }

    @Override
    public List<AgentStatisticsVO> messageStatistics(AgentManageDTO query) {
        query.setAppId(DifyAppEnum.getAppIdByCode(query.getAppCode()));
        return agentManageMapper.messageStatistics(query);
    }
}
